<?php

namespace  Sharks\Core\Make;

use Sharks\Core\AppContext;

/**
 * 错误显示
 * 依赖：
 *     AppConfigMaker
 */
class ErrorMaker extends Maker {
    
    public function dev(AppContext $app) {
        $whoops = new \Whoops\Run;
        $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
        $whoops->register();
    }
    
    public function server(AppContext $app) {
    	// # example for *.yml and default value is "false"
    	// error:
    	// 		display: false
       	if (AppConfig::get("error.diplay", false)) {
       		$whoops = new \Whoops\Run;
       		$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
       		$whoops->register();
		}
    }

    public function makers() {
    	return array(AppConfigMaker::class);
    }
}